package wormDemo2;

import java.util.Scanner;

public class WormTest {
	public static void main(String args[]){
		Scanner scanner = new Scanner(System.in);
		WormPanel wormPanel = new WormPanel();
		Worm worm = wormPanel.getWorm();
		while(true){
			wormPanel.print();
			String dir = scanner.nextLine();
			if(dir.equalsIgnoreCase("u")){
				worm.step(worm.UP);
			}
			else if(dir.equalsIgnoreCase("d")){
				worm.step(worm.DOWN);
			}
			else if(dir.equalsIgnoreCase("l")){
				worm.step(worm.LEFT);
			}
			else if(dir.equalsIgnoreCase("r")){
				worm.step(worm.RIGHT);
			}
			else if(dir.equalsIgnoreCase("e")){
				break;
			}
			else{
				worm.step();
			}
		}
	}
}
